<template>
  <div>
    <!-- <div class="item_title">第一代下级</div> -->
    <el-table
      :data="tableData"
      border
      style="width: 100%"
      id="out-table">
      <el-table-column
        prop="memberNum"
        label="会员编号">
      </el-table-column>
      <el-table-column
        prop="name"
        label="会员姓名">
      </el-table-column>
      <el-table-column
        prop="highestLevel"
        label="最高级别">
      </el-table-column>
      <el-table-column
        prop="currentLevel"
        label="当月级别">
      </el-table-column>
      <el-table-column
        prop="personalSales"
        label="个人销售积分">
      </el-table-column>
      <el-table-column
        prop="personalScore"
        label="个人当月积分">
      </el-table-column>
      <el-table-column
        prop="personalScore"
        label="个人累积分">
      </el-table-column>
      <el-table-column
        prop="lastMonthScore"
        label="上月组织累积分">
      </el-table-column>
      <el-table-column
        prop="currentMonthScore"
        label="本月累积分">
      </el-table-column>
      <el-table-column
        prop="groupScore"
        label="小组积分">
      </el-table-column>
      <el-table-column
        prop="truePrice"
        label="紧缩分">
      </el-table-column>
    </el-table>
    <div class="page">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="currentPage"
        :page-size="100"
        layout="prev, pager, next, jumper"
        :total="1000">
      </el-pagination>
    </div>
    <!-- <el-button type="primary" @click="exportExcel" class="excelBtn">导出excel</el-button> -->
  </div>
</template>

<script>
  import FileSaver from 'file-saver'
  import XLSX from 'xlsx'
  export default {
    data() {
      return {
        currentPage:1,
        tableData: [{
          memberNum:"01232142",
          name:"李伟",
          other:"李梅",
          highestLevel:"5",
          currentLevel:"3",
          personalSales:"25145.00",
          personalScore:"125465",
          lastMonthScore:"54412365",
          currentMonthScore:"12652485",
          groupScore:"115245",
          truePrice:"1452.00",
          IDcard:"445221199501245852"
        },{
          memberNum:"14521452",
          name:"程欣",
          other:"黄鹏",
          highestLevel:"7",
          currentLevel:"6",
          personalSales:"25145.00",
          personalScore:"125465",
          lastMonthScore:"54412365",
          currentMonthScore:"12652485",
          groupScore:"45647",
          truePrice:"1452.00",
          IDcard:"445221199501245852"
        },{
          memberNum:"02145252",
          name:"张华",
          other:"郑轨",
          highestLevel:"3",
          currentLevel:"2",
          personalSales:"25145.00",
          personalScore:"546574",
          lastMonthScore:"54412365",
          currentMonthScore:"12652485",
          groupScore:"115245",
          truePrice:"1452.00",
          IDcard:"445221199501245852"
        },
        {
          memberNum:"36548521",
          name:"李伟",
          other:"陈红",
          highestLevel:"7",
          currentLevel:"3",
          personalSales:"25145.00",
          personalScore:"125465",
          lastMonthScore:"54412365",
          currentMonthScore:"12652485",
          groupScore:"115245",
          truePrice:"1452.00",
          IDcard:"445221199501245852"
        },{
          memberNum:"00121452",
          name:"程欣",
          other:"莉莉",
          highestLevel:"4",
          currentLevel:"1",
          personalSales:"25145.00",
          personalScore:"125465",
          lastMonthScore:"54412365",
          currentMonthScore:"12652485",
          groupScore:"45647",
          truePrice:"1452.00",
          IDcard:"445221199501245852"
        },{
          memberNum:"11255240",
          name:"张华",
          other:"黄鹏",
          highestLevel:"8",
          currentLevel:"7",
          personalSales:"25145.00",
          personalScore:"546574",
          lastMonthScore:"54412365",
          currentMonthScore:"12652485",
          groupScore:"115245",
          truePrice:"1452.00",
          IDcard:"445221199501245852"
        }]
      }
    },
    methods:{
      // 分页
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      },
      exportExcel () {
         /* generate workbook object from table */
         var wb = XLSX.utils.table_to_book(document.querySelector('#out-table'))
         /* get binary string as output */
         var wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
         try {
             FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), 'sheetjs.xlsx')
         } catch (e) { if (typeof console !== 'undefined') console.log(e, wbout) }
         return wbout
     },
    }
  }
</script>